-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Draft: OpenAI chatkit support #3198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@safina57 I may have to dive deeper into ChatKit to see exactly how it differs from AG-UI and Vercel AI when it comes to persistence and extra features like widgets. But I'm inclined to say that anything to do with persistence is out of scope, and up to the user. Would the user be able to store the regular list of ModelRequest | ModelResponse messages, or does it need to be some ChatKit-specific representation with additional (meta)data?
I'd like to be able to support all ChatKit features, if feasible. How are things like widget and progress implemented? Just by streaming custom events to the frontend? Would that work with #2382 / #3114?
This PR is stale, and will be closed in 3 days if no reply is received.
Uh oh!
There was an error while loading. Please reload this page.
Closes #3098
Heyy @DouweM, Hope ur're doing well
I have started working on the integrating of OpenAI's ChatKit framework with Pydantic AI.
ChatKit operates differently from other UI protocols in several key ways:
Unlike simple request-response patterns, ChatKit works with persistent threads where each conversation is considered a sequence of different thread items (user messages, assistant messages, tool calls, widgets, etc.).
It supports advanced UI elements beyond text:
It also already provides comprehensive TypeScript definitions on the frontend and Python types in their official library, which I'm leveraging for type safety.
I've started implementing the adapter by importing types directly from the official
chatkitPython library:The core adapter structure follows Pydantic AI's
BaseAdapterpattern but with ChatKit-specific considerations:ModelMessageformat (currently in progress)Before continuing the implementation, I have some questions about the desired scope and approach:
1. Session Management Responsibility
Since we're making Pydantic AI agents ChatKit-protocol compatible, who should handle session management?
Option A: Full ChatKit Backend Implementation
ChatKitServerOption B: Adapter-Only Approach
2. Memory Store Integration
ChatKit's server implementation includes a
MemoryStoreinterface for persisting conversations. Should we:Option A: Provide ChatKit-Compatible Memory Store
Option B: Custom State Management
3. Protocol Compatibility Level
How closely should we follow ChatKit's backend implementation?
I would greatly appreciate your advice on the best path forward and on which specific ChatKit features or behaviors we should prioritize
Thanks in advance ^^!